package org.example.controller.teacher;

import org.example.service.File.DeleteDoc;
import org.example.service.File.FileDoc;
import org.example.pojo.Result;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import java.io.IOException;
import java.io.InputStream;
import java.util.List;

@RestController
@CrossOrigin
@RequestMapping("/teacher/doc")
public class FileController {

    @GetMapping("/delete")
    public Result deleteDoc(String docName){
        boolean b = DeleteDoc.deleteFile("D:\\1\\202119244329范铁凝");
        return Result.builder().data(b).build();
    }

    @GetMapping("/all")
    public Result GetDoc(){
        List<String> all = FileDoc.getAll();
        return Result.builder().data(all).build();
    }

    @PostMapping("/add")
    public void addDoc(@RequestParam("file") MultipartFile[] file) throws IOException {

        FileDoc.uploadFile(file);




    }
}
